package tomsung.cloud.agdc.common;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

public class I18nConst {
	private Properties i18n = new Properties();   
	private static I18nConst instance = null;
	private I18nConst()
	{
		InputStream in = I18nConst.class.getResourceAsStream("/i18n/i18n_zh_CN.properties");
		InputStreamReader reader = null;
        try {   
        	reader = new InputStreamReader(in, "UTF-8");
        	i18n.load(reader);  
        } catch (Exception e) {   
            e.printStackTrace();   
        } 
        finally
        {
        	try
        	{
        		if (reader != null)
        		{
        			reader.close();
        		}
        		if (in != null)
        		{
        			in.close();
        		}
			} 
        	catch (IOException e) 
			{
				e.printStackTrace();   
			}
        }
	}
	public static I18nConst getInstance()
	{
		if (instance == null)
		{
			instance = new I18nConst();
		}
		return instance;
	}
	
	public String getI18n(String v)
	{
		return i18n.getProperty(v);
	}
}
